package com.itfreer.gis.cad.analysis;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Component;

import com.itfreer.file.IAnalyseFileService;
import com.itfreer.gis.graphic.GisGraphic;
import com.itfreer.utils.json.JsonUtils;
/**
 * shape文件解析服务
 * @author gj
 *
 */
@Component("cadFileAnalysis")
public class CadFileAnalysisServiceImp implements IAnalyseFileService {

	@Override
	public String analyseFile(Map<String, String[]> param, String filePath,Object expnds) {
		try {
			List<GisGraphic> graphic=new DxfAnalysis().analysis(filePath);
			HashMap<String, Object> result=new HashMap<String, Object>();
			result.put("status", true);
			result.put("graphic", graphic.get(0));
			return JsonUtils.toJSONString(result);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return "{\"status\":false}";
	}

}
